import { getAreaObj } from '@/utils/util'
const tableConfig = {
	stripe: true,
	border: true,
	maxHeight: '80vh',
	columns: [
		{ label: '单位所在地区', prop: 'unitAddress' },
		{ label: '单位名称', prop: 'unitName' },
		{ label: '身份证号', prop: 'idCard', plusXing: '2,2' },
		{ label: '姓名', prop: 'practitionersName' },
		{ label: '联系方式', prop: 'phone', plusXing: '5,2' },
		{
			label: '专职',
			prop: 'workType',
			custome: 'tag',
			dicData: [
				{ label: '专职', value: 1, type: 'info' },
				{ label: '兼职', value: 2, type: 'success' },
			],
			span: 8,
		},

		{
			label: '职业类型',
			prop: 'occupationTypeLabel',
		},
		{
			label: '文化程度',
			prop: 'cultureDegreeLabel',
		},
		{
			label: '是否持证',
			prop: 'isHoldLabel',
			span: 8,
		},
		{
			label: '证件名称',
			prop: 'certificateName',
		},
		{
			label: '在职状态',
			prop: 'serviceStateLabel',
			span: 8,
		},
		{
			label: '操作',
			prop: 'menu',
			width: 300,
			fixed: 'right',
		},
	],
}

export const baseConfig = {
	pageName: '从业人员',
	dictcodes: ['ID_CARD_TYPE', 'NATIONALITY', 'POLITICAL_STATUS', 'EDUCATION_DEGREE', 'MARITAL_STATUS', 'MARITAL_STATUS', 'OCCUPATION_TYPE'],
	rowKey: 'id',
	api: {
		index: 'view_dpFoundationPractitioners_page',
	},
	auth: {
		index: 'view_dpFoundationPractitioners_page',
	},
	menuBtn: [
		{
			icon: 'detail',
			label: '查看详情',
			type: 'primary',
			operate: 'Archives',
			auth: 'view_dpFoundationPractitioners_page',
			text: true,
			show: true,
		},
	],
	dialogConfig: {
		width: '80%',
	},
	tableConfig,
	onLoadFormate: async (arr) => {
		const tableData = arr.map((item) => {
			const unitAddress: any = getAreaObj(item, 'unit', 'set')
			return {
				...(item.dpFoundationPractitionersExtendPO || {}),
				...item,
				unitAddress: unitAddress.names,
			}
		})
		return Promise.resolve(Object.freeze(tableData))
	},
}
